package TestThreadLocal;

import java.lang.ref.SoftReference;
import java.util.concurrent.TimeUnit;

/**
 * @Author Mr.Wen
 * @Version 1.0
 */
public class Test3 {
    public static void main(String[] args) {
        SoftReference softReference = new SoftReference(new Object());
        System.gc();
        try {
            TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException e) {
            System.out.println(e.getMessage() + "内存爆了~~~");
            throw new RuntimeException(e);
        }
        System.out.println("内存够用~");
        try {
            byte[] bytes = new byte[20 * 1024 * 1024];
        } catch (Exception e) {
            System.out.println(e.getMessage()+"内存爆了~~");
        }
    }
}
